package com.easou.ps.utils;

import java.util.ArrayList;
import java.util.List;

import com.easou.ps.thrift.search.types.SubWorkerSearchResult;
import com.easou.ps.webmaster.SubSearchResult;
/**
 * 转换子结果
 * @author dirk
 *
 */
public class SubResult2SubSearchResult {
	
	public static List<SubSearchResult> convert2SubSearchResult(List<SubWorkerSearchResult> subResult) {
		if (subResult == null) {
			return null;
		}
		List<SubSearchResult> result = new ArrayList<SubSearchResult>();
		for (SubWorkerSearchResult subResult2 : subResult) {
			SubSearchResult subSearchResult = new SubSearchResult();
			subSearchResult.setTitle(subResult2.getTitle());
			subSearchResult.setSummary(subResult2.getSummary());
			subSearchResult.setUrl(subResult2.getUrl());
			subSearchResult.setExtendFields(subResult2.getExtendFields());
//			subSearchResult.setWapType(WapType.findByValue(subResult2.getWapType()));
			if(subResult2.getLinks()!=null){				
				subSearchResult.setLinks(subResult2.getLinks());
			}
			result.add(subSearchResult);
		}
		return result;
	}
}
